<div class="modal" id="editUser">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal">x</button>
				<h4 class="modal-title">{{ Users_EditUser }} #{{ editUserId }}</h4>
			</div>
			<div class="modal-body">
				<div class="container">
					<div class="row">
						<div class="col-sm-8">
							<form>
								<div class="row">
									<div class="col-md-4">
										<div class="fileInput" ng-show="editUserHasAvatar" id="editUserAvatarUpdate" ondrop="drop(event)" ondragover="allowDrop(event)" ondragleave="dragleave(event)"><img ng-src="data:{{ editUserAvatarMime }};base64,{{ editUserAvatar }}" width="100%" /></div>
										<div class="fileInput" ng-hide="editUserHasAvatar" id="editUserAvatarNew" ondrop="drop(event)" ondragover="allowDrop(event)" ondragleave="dragleave(event)">Déposez une photo</div>
									</div>
									<div class="col-md-8">
										<div class="row form-group">
											<div class="col-xs-7">{{ Users_Fisrtname }} <input ng-model="editFirstname" class="form-control" placeholder="{{ Users_Fisrtname }}"/></div>
										</div>
										<div class="row form-group">
											<div class="col-xs-7">{{ Users_Lastname }} <input ng-model="editLastname" class="form-control" placeholder="{{ Users_Lastname }}"/></div>
										</div>
										<div class="row form-group">
											<div class="col-xs-7">{{ Users_Company }} <input ng-model="editCompany" class="form-control" placeholder="{{ Users_Company }}"/></div>
										</div>
									</div>
									<div class="row form-group">
										<div class="col-xs-6">{{ Users_Email }} <input ng-model="editEmail" class="form-control" placeholder="{{ Users_Email }}"/></div>
									</div>
									<div class="row form-group">
										<div class="col-xs-6">{{ Users_PhoneNumber }} <input ng-model="editPhoneNumber" class="form-control" placeholder="{{ Users_PhoneNumber }}"/></div>
									</div>
									<div class="row form-group">
										<div class="col-xs-6">{{ Users_WebAddress }} <input ng-model="editWebAddress" class="form-control" placeholder="{{ Users_WebAddress }}"/></div>
									</div>
									<div class="row form-group">
										<div class="col-xs-6">{{ Users_Profile }} 
											<select class="form-control" data-ng-options="pro for pro in profiles" data-ng-model="editProfile"></select>
										</div>
									</div>
									<div class="row form-group">
										<div class="col-xs-6">{{ Users_Login }} <input ng-model="editLogin" class="form-control" placeholder="{{ Users_Login }}"/></div>
									</div>
								</div>
								<img ng-hide="canUpdateUser" desc="banner" style="width:25px;height:25px" alt="{{ Main_Loading }}" src="assets/img//ajax-loader.gif" />
								<button ng-show="canUpdateUser" type="button" class="btn btn-primary" ng-click="updateUserCommand(editUserId, editFirstname, editLastname, editCompany, editEmail, editPhoneNumber, editWebAddress, editProfile, editLogin)">
									<span class="glyphicon glyphicon-ok"></span> {{ Main_Validate }}
								</button>
								<button ng-show="canUpdateUser" type="button" class="btn btn-primary" ng-click="updateUserPasswordCommand(editUserId)">
									<span class="glyphicon glyphicon-ok"></span> {{ Users_GeneratePassword }}
								</button>
							</form>
						</div>
					</div>
				</div>
			</div>
			<div class="modal-footer">
			</div>
		</div>
	</div>
</div>

<script>
	
	var editUserAvatarUpdate = document.getElementById("editUserAvatarUpdate");
	var editUserAvatarNew = document.getElementById("editUserAvatarNew");
	
	document.allowDrop = function(ev) {
		ev.preventDefault();
		editUserAvatarUpdate.style.background = '#E4E4E4';
		editUserAvatarNew.style.background = '#E4E4E4';
	}
	
	document.dragleave = function(event) {
		event.preventDefault();
		editUserAvatarUpdate.style.background = 'white';
		editUserAvatarNew.style.background = 'white';
	}
	
	document.drag = function(ev) {
		ev.dataTransfer.setData("poster", ev.target.id);
	}
	
	document.drop = function(ev) {
		ev.preventDefault();
		var dt = ev.dataTransfer;
		var files = dt.files;
		console.info('drop poster event ' + files.length);
		if(files.length > 0)
		{
			var firstFile = files[0];
			angular.element(document.getElementById('editUserAvatarUpdate')).scope().setAvatarCommand(firstFile);
		}
		editUserAvatarUpdate.style.background = 'white';
		editUserAvatarNew.style.background = 'white';
	}
</script>
